/*********************************************************************
*                                                                    *
*                SEGGER Microcontroller GmbH & Co. KG                *
*        Solutions for real time microcontroller applications        *
*                                                                    *
**********************************************************************
*                                                                    *
* C-file generated by:                                               *
*                                                                    *
*        GUI_Builder for emWin version 5.32                          *
*        Compiled Oct  8 2015, 11:59:02                              *
*        (c) 2015 Segger Microcontroller GmbH & Co. KG               *
*                                                                    *
**********************************************************************
*                                                                    *
*        Internet: www.segger.com  Support: support@segger.com       *
*                                                                    *
**********************************************************************
*/

// USER START (Optionally insert additional includes)
// USER END

#include "../STemWin/DIALOG.h"

/*********************************************************************
*
*       Defines
*
**********************************************************************
*/
#define ID_WINDOW_0   (GUI_ID_USER + 0x00)
#define ID_BUTTON_0   (GUI_ID_USER + 0x01)
#define ID_TEXT_0   (GUI_ID_USER + 0x02)
#define ID_TEXT_1   (GUI_ID_USER + 0x03)
#define ID_IMAGE_0   (GUI_ID_USER + 0x04)

#define ID_IMAGE_0_IMAGE_0   0x00

// USER START (Optionally insert additional defines)
// USER END

/*********************************************************************
*
*       Static data
*
**********************************************************************
*/
/*********************************************************************
*
*       _acImage_0, "C:\Users\Hare\Desktop\hare2.bmp", ID_IMAGE_0_IMAGE_0
*/
static const U8 _acImage_0[182] = {
  0x42, 0x4D, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xF8, 0x3C, 0x3F, 0xFC, 0xF7, 0xC3, 0xDF, 0xFC, 0xCF, 0xFF, 0xDF, 0xFC, 0xBF, 0xFF, 0xDF, 0xFC, 0xBF, 0xFF, 0xBF, 0xFC, 0xDF, 0xF2,
  0x7F, 0xFC, 0xDF, 0xFD, 0xFF, 0xFC, 0xEF, 0xFE, 0xF3, 0xFC, 0xEF, 0xFE, 0x8D, 0xFC, 0xF3, 0xFF, 0x7D, 0xFC, 0xFD, 0xFF, 0xFD, 0xFC, 0xFE, 0x7F, 0xE3, 0xFC, 0xFF, 0xBF, 0xDF, 0xFC, 0xFF, 0xCF, 0xBF, 0xFC, 0xFF, 0xF7, 0xDF, 0xFC, 0xFF, 0xF7, 0xE7, 0xFC,
  0xFF, 0xEF, 0xFB, 0xFC, 0xFF, 0x1F, 0xFD, 0xFC, 0xFE, 0xFF, 0x9E, 0xFC, 0xFD, 0xFF, 0x9E, 0xFC, 0xFB, 0xFF, 0xFD, 0xFC, 0xFD, 0x8F, 0xFB, 0xFC, 0xFE, 0x77, 0xE7, 0xFC, 0xFF, 0xEF, 0x1F, 0xFC, 0xFF, 0xDE, 0xFF, 0xFC, 0xFF, 0xBD, 0xFF, 0xFC, 0xFF, 0xBB,
  0xFF, 0xFC, 0xFF, 0xB7, 0xFF, 0xFC, 0xFF, 0xCF, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF, 0xFC,
};

// USER START (Optionally insert additional static data)
extern int CreateWindowSpinbox(void);
// USER END

/*********************************************************************
*
*       _aDialogCreate
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
  { WINDOW_CreateIndirect, "WindowStart", ID_WINDOW_0, 0, 0, 320, 240, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "Start", ID_BUTTON_0, 101, 75, 115, 53, 0, 0x0, 0 },
  { TEXT_CreateIndirect, "harebit", ID_TEXT_0, 138, 170, 80, 20, 0, 0x0, 0 },
  { TEXT_CreateIndirect, "Touch screen", ID_TEXT_1, 99, 30, 120, 20, 0, 0x0, 0 },
  { IMAGE_CreateIndirect, "Image", ID_IMAGE_0, 91, 160, 33, 35, 0, 0, 0 },
  // USER START (Optionally insert additional widgets)
  // USER END
};

/*********************************************************************
*
*       Static code
*
**********************************************************************
*/
/*********************************************************************
*
*       _GetImageById
*/
static const void * _GetImageById(U32 Id, U32 * pSize) {
  switch (Id) {
  case ID_IMAGE_0_IMAGE_0:
    *pSize = sizeof(_acImage_0);
    return (const void *)_acImage_0;
  }
  return NULL;
}

// USER START (Optionally insert additional static code)
// USER END

/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  const void * pData;
  WM_HWIN      hItem;
  U32          FileSize;
  int          NCode;
  int          Id;
  // USER START (Optionally insert additional variables)
  // USER END

  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Initialization of 'Start'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
    BUTTON_SetFont(hItem, GUI_FONT_20_1);
    //
    // Initialization of 'harebit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
    TEXT_SetFont(hItem, GUI_FONT_20B_ASCII);
    //
    // Initialization of 'Touch screen'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
    TEXT_SetFont(hItem, GUI_FONT_20B_ASCII);
    //
    // Initialization of 'Image'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_0);
    pData = _GetImageById(ID_IMAGE_0_IMAGE_0, &FileSize);
    IMAGE_SetBMP(hItem, pData, FileSize);
    // USER START (Optionally insert additional code for further widget initialization)
    // USER END
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case ID_BUTTON_0: // Notifications sent by 'Start'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
    	  CreateWindowSpinbox();
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    // USER START (Optionally insert additional code for further Ids)
    // USER END
    }
    break;
  // USER START (Optionally insert additional message handling)
  // USER END
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}

/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       CreateWindowStart
*/
WM_HWIN CreateWindowStart(void);
WM_HWIN CreateWindowStart(void) {
  WM_HWIN hWin;

  hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
  return hWin;
}

// USER START (Optionally insert additional public code)
// USER END

/*************************** End of file ****************************/
